<!--
- Author:  LiShibin.
- Date:    2018/2/8 0008.
- File:    download.
-->
<template>
  <div class="download">
    <!--<div class="downtop f-cb" v-if="$deviceType == 'wx-Android' || $deviceType == 'wx-iPhone'">-->
    <!--<div class=" wenzi">点击右上角按钮，然后在弹窗菜单中，点击在浏览器中打开，即可安装</div>-->
    <!--<div class=" img"><img src="../../assets/images/dowicon.png"></div>-->
    <!--</div>-->
    <div class="downlogo"><img src="../../assets/images/hl-logo.png"></div>
    <div class="downbox">
      <div class="downbtn" @click="downloadAndroid" v-show="$deviceType == 'wx-Android' || $deviceType == 'Android' || $deviceType == 'APICloud' || $deviceType == 'Windows'"><i class="iconfont icon-android"></i>安卓下载</div>
      <div class="downbtn" @click="downloadIos"  v-show="$deviceType == 'wx-iPhone' || $deviceType == 'iPhone' || $deviceType == 'APICloud' || $deviceType == 'Windows'"><i class="iconfont icon-ios"></i>IOS下载</div>
    </div>
    <!--<div class="Extension"  style="text-align: center" v-show="$deviceType == 'APICloud'"><a @click="wxShare" style="float: none; margin: 0; display: inline-block">分享</a></div>-->
    <!--<footer-tab v-show="$deviceType != 'wx-iPhone' &&  $deviceType != 'wx-Android'"></footer-tab>-->
  </div>
</template>

<script>
  let bodyClass = document.body.className

  export default{
    beforeRouteEnter (to, from, next) {
      document.body.className = 'bg-white'
      next()
    },
    beforeRouteLeave  (to, from, next) {
      document.body.className = bodyClass
      next()
    },
    data() {
      return {}
    },
    components: {},
    methods: {
      downloadAndroid() {
        if (this.$deviceType == 'APICloud') {
          this.$toast('分享后，点击分享的链接下载')
        } else {
          window.location = this.$config.androidDownUrl
        }
      },
      downloadIos() {
        if (this.$deviceType == 'APICloud') {
          this.$toast('分享后，点击分享的链接下载')
        } else {
          window.location = this.$config.iosDownUrl
        }
      },
      wxShare() {
        let _this = this
        var wx = window.api.require('wx')
        wx.shareWebpage({
          apiKey: '',
          scene: 'session',
          title: '花链会员平台App下载',
          description: '欢迎下载使用',
          contentUrl: _this.$config.website + '/wap/setting/download'
        }, function(ret, err) {
          if (ret.status) {
            this.$toast('分享成功')
          } else {
            this.$toast('分享失败:' + err.code)
          }
        })
      }
    }
  }
</script>

<style>

</style>